import bean.DefaultBeanFactory;
import com.test.beans.UserService;
import sacnner.ClassPathBeanDefinitionScanner;

public class TestAnnotationRegistration {
    public static void main(String[] args) {
        DefaultBeanFactory factory = new DefaultBeanFactory();
        ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(factory);

        // 扫描指定包（需引入反射库如 org.reflections）
        scanner.scan("com.test.beans");

        UserService userService = (UserService) factory.getBean("userService");
        System.out.println(userService.getUserName());
    }
}